home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Shareware World / Info / For Developers / Smile1.6.6.sea / Smile1.6.6 / Smile ƒ / Help files / Button example 2 < prev    next >
Text File  |  1999-08-03  |  2KB  |  50 lines

  1. Button example 2
  2.  
  3.  
  4. Please be familiar with the material of Button Example 1 before proceeding with Example 2 of this section. 
  5.  
  6.  
  7. Custom Button Example 2 - Displaying the amount of free memory. 
  8.  
  9. ----------------------------
  10. on mouseUp(theButton)
  11.     set name of theButton to "" & (my free memory) div 1024 & " Kb free"
  12. end mouseUp
  13. ----------------------------
  14.  
  15. Follow these steps to try the above one-line script - 
  16.  
  17. 1. -click on "Empty Button" to open its script window. 
  18.  
  19. 2. Enter the above script as follows : 
  20.  
  21. ----------------------------
  22. on mouseUp(theButton)
  23. (Your custom script or Example)
  24. end mouseUp 
  25. ----------------------------
  26.  
  27. 3. Press the Enter-key to compile. 
  28.  
  29. 4. Close the "Empty Button" script window and click "Yes" from the dialog box. 
  30.  
  31. Run the script by clicking on the button. The script of Example 2 will display the amount of free memory (in Kbytes) in the button each time the button is clicked. 
  32.  
  33. Note that free memory decreases : 
  34.  
  35. • When more Smile windows are opened. 
  36.  
  37. • A large amount of data is stored in a variable. 
  38.  
  39. See  Button Example 3 for another custom button example. 
  40.  
  41. ========================================================
  42.  
  43. Advanced
  44.  
  45. • The "free memory" command will return the size of the largest block of RAM free for Smile use. If Smile needs more memory, it may compact memory and recover more memory than the amount displayed.
  46.  
  47. The free memory value displayed in the button will be the same value as displayed in "About This Macintosh." (From the Finder, choose "About This Macintosh" from the Apple menu. Use "Get information" in the Finder's "File" menu to find the memory allocated to Smile and the memory actually used. Subtract to find "free memory".) 
  48.  
  49. ========================================================
  50.